<%--
  Created by IntelliJ IDEA.
  User: Administrator
  Date: 2020/10/28
  Time: 22:05
  To change this template use File | Settings | File Templates.
--%>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<html>
<head>
    <title>Title_name:Response</title>

    <script src="js/jquery.min.js"></script>
    <script>
//        页面加载，绑定单击事件
$(function(){
    $("#btn").click(function(){
//         alert("hello btn");
        // 发送ajax请求
                $.ajax({
                    //编写json格式 设置属性和值
                    url:"user/testAjax",
                    contentType:"application/json;charset=UTF-8",
                    data:'{"username":"ledehui","password":"123","age":30}',
                    dataType:"json",
                    type:"post",
                    success:function (data) {
//                        data服务器端响应的json的数据，进行解析
                        alert(data);
                        alert(data.username);
                        alert(data.age);
                        alert(data.password);
                    }

                })
                });
        });
    </script>
</head>
<body>
<a href="user/testString">testString</a><br>
<a href="user/testVoid">testVoid</a><br>
<a href="user/testModleAndView">testModleAndView</a><br>
<a href="user/testForwardOrRedirect">testForwardOrRedirect</a><br>
<br>
<button id="btn">发送ajax请求</button>
<br>
<input type="file">

</body>
</html>
